package git.soulbgm.mapreduce.partitionerAndComparable;

import git.soulbgm.mapreduce.utils.DriverUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;

import java.io.IOException;

/**
 * @author SoulBGM
 * @date 2021/11/18 0:07
 */
public class FlowDriver {

    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
        Job job = DriverUtil.createJob(
                FlowDriver.class, FlowMapper.class, FlowReducer.class,
                FlowBean.class, Text.class, Text.class, FlowBean.class,
                new Path(args[0]), new Path(args[1]));

        //设置分区规则
        job.setPartitionerClass(ProvincePartitioner.class);
        //设置分区数量
        job.setNumReduceTasks(5);

        // 7 提交job
        boolean result = job.waitForCompletion(true);
        System.exit(result ? 0 : 1);
    }



}
